﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Net;
using System.IO;

namespace BusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "WCFMessaging" in code, svc and config file together.
    public class WCFMessaging : IWCFMessaging
    {
        /// <summary>
        /// This method sends a message to the mobile number passed as a parameter
        /// </summary>
        /// <param name="no"></param>
        public void SendSMS(string no)
        {
            WebClient wc = new WebClient();
            wc.QueryString.Add("user", "anthscic94");
            wc.QueryString.Add("password", "PQYKBWQPAbJIHR");
            wc.QueryString.Add("api_id", "3477577");
            wc.QueryString.Add("to", no);
            wc.QueryString.Add("text", "Your product fault status has been updated");
            string ApiUrl = "http://api.clickatell.com/http/sendmsg";
            Stream s = wc.OpenRead(ApiUrl);
            StreamReader sr = new StreamReader(s);
            string S = sr.ReadToEnd();
            s.Close();
            sr.Close();            
            
        }
    }
}
